Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit?id=
80d01c4ccb697b9d
Last-Update: 2025-12-14
The loadRelaxed() at the beginning of tryLockForRead/tryLockForWrite
isn't enough to bring us the non-atomic write of the recursive bool.
Same issue with the std::mutex itself.
Gbp-Pq: Name qreadwritelock_data_race.diff
d = val;
}
Q_ASSERT(!isUncontendedLocked(d));
- // d is an actual pointer;
+ // d is an actual pointer; acquire its contents
+ d = d_ptr.loadAcquire();
+ if (!d || isUncontendedLocked(d))
+ continue;
if (d->recursive)
return d->recursiveLockForRead(timeout);
d = val;
}
Q_ASSERT(!isUncontendedLocked(d));
- // d is an actual pointer;
+ // d is an actual pointer; acquire its contents
+ d = d_ptr.loadAcquire();
+ if (!d || isUncontendedLocked(d))
+ continue;
if (d->recursive)
return d->recursiveLockForWrite(timeout);